/**
 * 
 */
package com.base.myproject.client.busi;

import com.base.myproject.client.jdbc.StoreInfo;

/**
 * @author zgw 2009-8-17 下午02:27:38 javazgw@gmail.com
 */
public final class HtmlCommandFactory {

	/**
	 * 导航命令
	 * 
	 * @return
	 */
	// @SuppressWarnings("static-access")
	public static void getNavigation(String treecode) {

		StoreInfo info = com.base.myproject.client.busi.b2c.MainPage
				.getMainpage().getImagestore().getStoreinfo();
		info.setFilter(" where treecode like '%" + treecode + "%'");
		com.base.myproject.client.busi.b2c.MainPage.getMainpage()
				.getImagestore().setStoreinfo(info);
		com.base.myproject.client.busi.b2c.MainPage.getMainpage()
				.getImagestore().reload();
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel()
				.removeAll();
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel().add(
				com.base.myproject.client.busi.b2c.MainPage.getMainpage()
						.CreateGcode());
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel().layout();
		// 从新组织导航
		com.base.myproject.client.busi.b2c.MainPage.getToppanelleft()
				.removeAll();
		com.base.myproject.client.busi.b2c.MainPage.getToppanelleft().layout();

	}

	public static void getNavigationMainpage() {

		StoreInfo info = com.base.myproject.client.busi.b2c.MainPage
				.getMainpage().getImagestore().getStoreinfo();

		info.setFilter(" where treecode like '%%'");
		com.base.myproject.client.busi.b2c.MainPage.getMainpage()
				.getImagestore().setStoreinfo(info);
		com.base.myproject.client.busi.b2c.MainPage.getMainpage()
				.getImagestore().reload();
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel()
				.removeAll();
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel().add(
				com.base.myproject.client.busi.b2c.MainPage.getMainpage()
						.CreateGcode());
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel().layout();
		// 从新组织导航
		com.base.myproject.client.busi.b2c.MainPage.getToppanelleft()
				.removeAll();
		com.base.myproject.client.busi.b2c.MainPage.getToppanelleft().layout();
	}

	/**
	 * 根据分类显示，比如光显示手机
	 */
	public static void getNavigationgroup(String gcode) {

		StoreInfo info = com.base.myproject.client.busi.b2c.MainPage
				.getMainpage().getImagestore().getStoreinfo();

		info.setFilter(" where gcode = '" + gcode + "'");
		com.base.myproject.client.busi.b2c.MainPage.getMainpage()
				.getImagestore().setStoreinfo(info);
		com.base.myproject.client.busi.b2c.MainPage.getMainpage()
				.getImagestore().reload();
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel()
				.removeAll();
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel().add(
				com.base.myproject.client.busi.b2c.MainPage.getMainpage()
						.CreateGcode());
		com.base.myproject.client.busi.b2c.MainPage.getCenterpanel().layout();
		// 从新组织导航
		com.base.myproject.client.busi.b2c.MainPage.getToppanelleft()
				.removeAll();
		com.base.myproject.client.busi.b2c.MainPage.getToppanelleft().layout();

	}

	public static native void Navigation()/*-{
		$wnd._topnavigation = function(treecode){

			@com.base.myproject.client.busi.HtmlCommandFactory::getNavigation(Ljava/lang/String;)(""+treecode+"");
		}
		$wnd._topnavigationmainpage = function(){

			@com.base.myproject.client.busi.HtmlCommandFactory::getNavigationMainpage()();
		}
			$wnd._topnavigationgrouppage = function(gcode){

			@com.base.myproject.client.busi.HtmlCommandFactory::getNavigationgroup(Ljava/lang/String;)(""+gcode+"");
		}
		//显示用户的订单
				$wnd._show_user_shoping_listorder = function(ccode){

			@com.base.myproject.client.busi.b2c.UserInfoPanel::ShowShoppingOrder(Ljava/lang/String;)(""+ccode+"");
		}

				//显示用户的购物车
				$wnd._show_user_shoping_cart = function(ccode){

			@com.base.myproject.client.busi.b2c.UserInfoPanel::ShowShoppingCart(Ljava/lang/String;)(""+ccode+"");


		}
				//显示可以编辑用户资料
				$wnd._show_edit_myinfo = function(ccode){

			@com.base.myproject.client.busi.b2c.UserInfoPanel::ShowEditMyinfo(Ljava/lang/String;)(""+ccode+"");
				}
							//显示用户资料
				$wnd._show_myinfo = function(ccode){

			@com.base.myproject.client.busi.b2c.UserInfoPanel::ShowMyinfo(Ljava/lang/String;)(""+ccode+"");
				}
				
			
	}-*/;

	
	public static void InitatSetup() {
		Navigation();
	}

}
